/*package poker;
import java.io.*;
public abstract class Player {
	Card[] Hand;
	public Player() {
		System.out.println("Player Human/Bot? (H/B)");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try {
				String string=br.readLine();
				switch(string){
					case "H": 
						Human gracz=new Human();
						break;
					case "B":
						Bot bot=new Bot();
						break;
				}
			} catch (IOException e) {
			     System.out.println("Error reading line");
			}
	}

}
*/


package poker;
public abstract class Player
{	
	Table table;
	int HowManyChanged;	
	Card[] Hand;
	int k;
	
	public Player(Table table)
	{
		Hand=new Card[5];
		this.table=table;
		HowManyChanged=0;
		for{int i=0; i<4; i++)
		{
			Hand[i]=drawCard();
		}	
	}
	
	public void ChangeCard(int i) 
	{
		try
		{
			Hand[i]=drawCard();
		}
		catch(TableException exc)
		{
			System.out.println(exc.getMessage());
		}
	}
	public Card[] switchCards(Card[] Hand,int index,int minimal){
		Card temp;
		temp=Hand[index];
		Hand[index]=Hand[minimal];
		Hand[minimal]=temp;
		return Hand;
	}
	public Card[] sortHand(Card[] Hand){
		int index,x,minimal;
		for(x=0;x<4;x++){
			minimal=x;
			for(index=x;index<5;index++){
			if(Hand[index].getRank()<Hand[minimal].getRank())
				minimal=index;
			Hand=switchCards(Hand,x,minimal);
			}
		}
		return Hand;
	}
}

